﻿namespace DoNet.Wechat
{
    /// <summary>
    /// access_token请求后的JSON返回格式
    /// </summary>
    public interface IAccessTokenResult : IJsonResult
    {
        /// <summary>
        /// 获取到的凭证
        /// </summary>
        string access_token { get; set; }
        /// <summary>
        /// 凭证有效时间，单位：秒
        /// </summary>
        int expires_in { get; set; }
        /// <summary>
        /// 过期时间
        /// </summary>
        DateTimeOffset? expire_time { get; set; }
    }

    [Serializable]
    public class AccessTokenResult : JsonResult, IAccessTokenResult
    {
        /// <summary>
        /// 获取到的凭证。长度为64至512个字节
        /// </summary>
        public string access_token { get; set; } = string.Empty;
        /// <summary>
        /// 凭证的有效时间（秒）
        /// </summary>
        public int expires_in { get; set; }
        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTimeOffset? expire_time { get; set; }
    }
}
